function addProjectSearch(type,name) {
	var url = '';
	if(type == 'project') url = 'http://code.google.com/p/'+name+'/';
	else url = 'http://groups.google.com/group/'+name+'/about';
	
	$('row-search-submit').className = 'invisible';
	$('search-output').className = 'visible';
	$('search-query').className = 'visible';
	var iFrame = new IFrame({
	    src: url,
	    styles: {
	        width: 930,
	        height: 300,
	        border: '1px solid #CCCCCC'
	    }
	});
	$('search-output').innerHTML = '';
	iFrame.inject($('search-output'));
}

function checkGoogleCode() {
	$('check-output').innerHTML = '';
	var url = "http://groups.google.com/group/"+$('google-code').value;
	var iFrame = new IFrame({
	    src: url,
	    styles: {
	        width: 900,
	        height: 320,
	        border: '1px solid #CCCCCC'
	    }
	});
	popup("check-frame");
	iFrame.inject('check-output');
}

function checkGoogleGroups() {
	$('check-output').innerHTML = '';
	var url = "http://code.google.com/p/"+$('google-groups').value+"/";
	var iFrame = new IFrame({
		src: url,
		styles: {
		width: 900,
		height: 320,
		border: '1px solid #CCCCCC'
	}
	});
	popup("check-frame");
	iFrame.inject('check-output');
}

function resetAddProject() {
	$('row-search-submit').className = 'visible';
	$('search-output').className = 'invisible';
	$('search-query').className = 'invisible';
	$('search-output').innerHTML = '';
	$('search-name').value = '';
	$('search-name').focus();
}

function checkStudents(id) {
	if($('check-'+id).checked == false) {
		$('full-name'+id).disabled = 'disabled';
		$('gmail'+id).disabled = 'disabled';
	} else {
		$('full-name'+id).disabled = '';
		$('gmail'+id).disabled = '';
	}
}

window.addEvent('domready',function() {
	if($('student-count')) {
		$('student-count').addEvent('keydown', function(event) {
			if(isNaN(event.key) && event.key != 'backspace' && event.key != 'enter') event.stop();
		});
	}
	if($('student-count-submit')) {
		$('student-count-submit').addEvent('click',function() {
			var total = $('student-count').value;
			new Request( {
				method : 'get',
				url : '/addgroup.php?x='+total,
				onComplete : function(response) {
					$('students').innerHTML = response;
					$('row-students-submit').className = 'visible';
					if($('full-name1')) {
						$('full-name1').focus();
					}
				}
			}).send();
		});
	}
	if($('student-email-submit')) {
		$('student-email-submit').addEvent('click',function() {
			var total = $('student-count').value;
			new Request( {
				method : 'get',
				url : '/addgroup.php?y='+total,
				onComplete : function(response) {
				$('students').innerHTML = response;
				$('row-students-submit').className = 'visible';
				if($('gmail1')) {
					$('gmail1').focus();
				}
			}
			}).send();
		});
	}
});